#@adminLayout()
#define main()
#set(map={C:1,R:1,U:1,D:1,O:1},aTh=["名称","状态"],aTd=["name","isEnable"])
<div class="card">
    #@cardIndex("系统分类管理","sys/taxonomy",map,aTh,aTd)
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('.modal-backdrop').remove();
        $('body').css("overflow", "auto");
    });
</script>
#end
#define cardBtn()
#end
#define cardQuery()
<div class="col-sm-4">
    <div class="form-group">
        <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>名称</lable>
        <input type="text" name="name" value="#(model.name??)"
               class="form-control" placeholder="请输入名称">
        <i class="form-group__bar"></i>
    </div>
</div>
#end
#define cardIndexTbody()
<td data-column="isEnable">
    #(x.isEnable==0?"<span style='color: red'>停用</span>":"<span style='color: #00CC33'>启用</span>")
</td>
#end

#define cardIndexBtn()
    #if(x.isEnable==0)
        <button class="btn btn-sm btn-outline-success waves-effect" onclick="updateEnable(#(x.id),1)" title="启用">
            <i class="zmdi zmdi-check"></i>启用
        </button>
    #else
        <button class="btn btn-sm btn-outline-danger waves-effect" onclick="updateEnable(#(x.id),0)" title="停用">
            <i class="zmdi zmdi-close"></i>停用
        </button>
    #end
#end
<script type="text/javascript">
    function updateEnable(a,b) {
        $.post("/admin/sys/taxonomy/updateEnable",{"id":a,"type":b},function (ret) {
            showRetMsg(ret,"/admin/sys/taxonomy/");
        })
    }
</script>